//index.js
//获取应用实例
const app = getApp()
const http = require('../../http/http')
Page({
  data: {
    songs: [],
    songsBottom: []
  },
  onLoad() {
    var This = this;
    (async function () {
      var res = await http.handleData();
      console.log(res.data.artists[1].name);
      var { artists } = res.data
      var songs = [];
      var songsBottom = []
      for (let i = 0; i < artists.length; i++) {
        if (i < 25) { songs.push(artists[i]) } else { songsBottom.push(artists[i]) }
      }
      This.setData({
        songs,
        songsBottom
      })
    })()
   
  },
  onReachBottom() {
    var songs=this.data.songs;
    var songb=this.data.songsBottom;
    songs = songs.concat(songb)
    this.setData({
      songs,
    })
  }

})
